package com.api.controller;


import com.api.common.ResultMsg;
import com.api.model.User;
import com.api.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class ApiUserController {

    @Autowired
    private UserService userService;


    @RequestMapping("/index")
    public String homepage(){
        return "index";
    }

    @RequestMapping("sign01")
    public String home(){
        return "pageapp-signup";
    }
    @RequestMapping("login01")
    public String home1(){
        return "pageapp-login";
    }


    @RequestMapping("login")
    public String login(User query)  {
        User user = userService.login(query);
        if(user!=null){
            return "index";
        }
        return "pageapp-login";
    }

}
